﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="FoodDetail.aspx.vb" Inherits="Week3Wscc.HotelDetail" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style2
        {
            font-size: medium;
        }
        .emptypng { background-image: url("pictures/misc/rating_icon.png"); width: 25px; height: 28px; }
        .ratingpng { background-image: url("pictures/misc/rating_icon_g.png"); width: 25px; height: 28px; }
        .donepng { background-image: url("pictures/misc/rating_icon_g.png"); width: 25px; height: 28px; }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Food Details<br />       
    </h2>
    <p>
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" BackColor="#CCCCCC" 
            BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" 
            CellSpacing="2" DataKeyNames="ID" ForeColor="Black">
            <Columns>
                <asp:BoundField DataField="FoodName" HeaderText="Food Name" 
                    SortExpression="FoodName" />
                <asp:BoundField DataField="FoodBrand" HeaderText="Brand" 
                    SortExpression="FoodBrand" />
                <asp:BoundField DataField="FoodSize" HeaderText="Size" 
                    SortExpression="FoodSize" />
                <asp:BoundField DataField="FoodDescription" 
                    HeaderText="Description" 
                    SortExpression="FoodDescription" />
                <asp:BoundField DataField="FoodBestBefore" HeaderText="Best-Before Date" 
                    SortExpression="FoodBestBefore" />
                <asp:BoundField DataField="FoodOriginalPriceCurrency" 
                    HeaderText="Original Price" 
                    SortExpression="FoodOriginalPriceCurrency" />
                <asp:ImageField DataImageUrlField="FoodPicture" HeaderText="Picture">
                    <ControlStyle Height="150px" Width="200px" />
                </asp:ImageField>
                <asp:BoundField DataField="InExchangeFor" HeaderText="In Exchange For" 
                    SortExpression="InExchangeFor" />
                    

                <asp:TemplateField HeaderText="User">
                <ItemTemplate>
                <a href='Profile.aspx?FoodUser=<%# Eval("FoodUser") %>'><%# Eval("FoodUser") %>
                </a>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>

            <FooterStyle BackColor="#CCCCCC" />
            <HeaderStyle BackColor="#5078B3" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
            <RowStyle BackColor="White" />
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
            
            
            
            
            
            SelectCommand="SELECT * FROM [food] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        &nbsp;</p>

     <asp:Accordion
    ID="Accordion2"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane3" runat="server">
            <Header><img src="/pictures/misc/comments_icon.png" /> Commenting</Header>

   <Content>
  
    <strong><span class="style2">Comments</span></strong><p>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            AllowSorting="True" BackColor="#CCCCCC" 
            BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" 
            CellSpacing="2" DataKeyNames="ID" ForeColor="Black">

            <Columns>
                <asp:BoundField DataField="Author" HeaderText="Author" 
                    SortExpression="Author" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Comment" HeaderText="Comment" 
                    SortExpression="Comment" />
            </Columns>
                        <FooterStyle BackColor="#CCCCCC" />
            <HeaderStyle BackColor="#5078B3" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
            <RowStyle BackColor="White" />
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
            SelectCommand="SELECT [ID], [Author], [Comment], [Title], [Food_FKID] FROM [comments] WHERE ([Food_FKID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Food_FKID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <p>
    </p>
    <p class="style2">
        <strong>Please add your comment here</strong></p>
    <p>
    &nbsp;</p>
    <p>
        Comment Title 
        <asp:TextBox ID="tb_Title" runat="server"></asp:TextBox>
    </p>
    <p>
        Your Comment</p>
    <p>
    &nbsp;<asp:TextBox ID="tb_Comment" runat="server" Height="141px" 
            TextMode="MultiLine" Width="563px"></asp:TextBox>
    </p>
     <p>
        <asp:Button ID="btn_AddComment" runat="server" Text="Add Comment" />
    </p>
                   
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>



 
<asp:Accordion
    ID="Accordion1"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane2" runat="server">
            <Header><img src="/pictures/misc/info_icon.png" /> Rating</Header>

   <Content>

    <p>
        <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource3" 
            style="margin-bottom: 0px">
            <EditItemTemplate>
                AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageRating") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageRating") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                <strong>The current Average Rating is
                <asp:Label ID="AverageRatingLabel" runat="server" style="color: #FF0000" 
                    Text='<%# Bind("AverageRating") %>' />
                </strong>. <strong>
                <br />
                Now it´s your turn, please rate this listing:</strong><br />
                <br />
            </ItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
            SelectCommand="SELECT [AverageRating] FROM [AverageRating] WHERE ([Food_FKID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Food_FKID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
     <asp:Rating ID="Rating1" runat="server" CurrentRating="1" EmptyStarCssClass="emptypng" FilledStarCssClass="ratingpng" StarCssClass="ratingpng" WaitingStarCssClass="donepng">
    </asp:Rating>
    </p>
    <p>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
    </p>
    <br />
       <p>
    <asp:Button ID="btn_SaveRating" runat="server" Text="Save Rating" />
    </p>

        <asp:Label ID="Label1" runat="server" 
                 Text="Please note: Resubmitting a rating will overwrite your previous one!" 
                 BorderStyle="None" ForeColor="Red"></asp:Label>
        
                   
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>


       
    <asp:Accordion
    ID="Accordion0"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
                <asp:AccordionPane ID="AccordionPane1" runat="server">
            <Header><img src="/pictures/misc/info_icon.png" /> Tagging</Header>

   <Content>
           <b>Select from existing tags </b>

    <asp:CheckBoxList ID="cb_tags" runat="server" 
        DataSourceID="tagsDataSource" DataTextField="Tag" DataValueField="ID" 
        RepeatDirection="Horizontal">
    </asp:CheckBoxList>
    
    
    <asp:SqlDataSource ID="tagsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>"       
    SelectCommand="SELECT [ID], [Tag] FROM [tags] WHERE ([Tag] &lt;&gt; ?)">
        <SelectParameters>
            <asp:Parameter DefaultValue=" " Name="Tag" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    
    Or add new tags here (separate tags by comma): <asp:TextBox ID="TextBox1" 
            runat="server" Width="335px"></asp:TextBox><br />
       <asp:Button ID="btn_addTag" runat="server" Text="Add new tag" />
                   
            </Content>
        </asp:AccordionPane>            
    </Panes>            

</asp:Accordion>


</asp:Content>




